package com.chanshuyi.dao.mapper;

import static org.apache.ibatis.jdbc.SqlBuilder.BEGIN;
import static org.apache.ibatis.jdbc.SqlBuilder.INSERT_INTO;
import static org.apache.ibatis.jdbc.SqlBuilder.SET;
import static org.apache.ibatis.jdbc.SqlBuilder.SQL;
import static org.apache.ibatis.jdbc.SqlBuilder.UPDATE;
import static org.apache.ibatis.jdbc.SqlBuilder.VALUES;
import static org.apache.ibatis.jdbc.SqlBuilder.WHERE;

import com.chanshuyi.model.SysCode;

public class SysCodeSqlProvider {

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table SysCode
     *
     * @mbggenerated Wed Jul 12 20:57:03 CST 2017
     */
    public String insertSelective(SysCode record) {
        BEGIN();
        INSERT_INTO("SysCode");
        
        if (record.getCodeId() != null) {
            VALUES("codeId", "#{codeId,jdbcType=INTEGER}");
        }
        
        if (record.getCodeTypeId() != null) {
            VALUES("codeTypeId", "#{codeTypeId,jdbcType=INTEGER}");
        }
        
        if (record.getCodeName() != null) {
            VALUES("codeName", "#{codeName,jdbcType=VARCHAR}");
        }
        
        if (record.getParentCodeId() != null) {
            VALUES("parentCodeId", "#{parentCodeId,jdbcType=INTEGER}");
        }
        
        return SQL();
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table SysCode
     *
     * @mbggenerated Wed Jul 12 20:57:03 CST 2017
     */
    public String updateByPrimaryKeySelective(SysCode record) {
        BEGIN();
        UPDATE("SysCode");
        
        if (record.getCodeTypeId() != null) {
            SET("codeTypeId = #{codeTypeId,jdbcType=INTEGER}");
        }
        
        if (record.getCodeName() != null) {
            SET("codeName = #{codeName,jdbcType=VARCHAR}");
        }
        
        if (record.getParentCodeId() != null) {
            SET("parentCodeId = #{parentCodeId,jdbcType=INTEGER}");
        }
        
        WHERE("codeId = #{codeId,jdbcType=INTEGER}");
        
        return SQL();
    }
}